package com.controller;

import com.entity.Dept;
import com.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/consumer/dept")
public class DeptConsumerController {
	
	@Autowired
	private DeptService deptService;
	
	@RequestMapping("/add")
	public boolean add(Dept dept) {
		return deptService.addDept(dept);
	}
	
	@RequestMapping("/get/{id}")
	public Dept get(@PathVariable(value = "id") Long id) {
		return  deptService.queryById(id);
	}
	
	@RequestMapping("/list")
	public List< Dept > list() {
		System.out.println("S的速度");
		return  deptService.queryAll();
	}
}
